import 'dart:async';

import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'timer_controller.g.dart';

@riverpod
class TimerController extends _$TimerController {
  @override
  int build(int start) {
    Timer.periodic(const Duration(seconds: 1), (timer) {
      state = start - timer.tick;
    });
    return start;
  }
}
